﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WpfRcp.Core.Services.Commands;
using System.Windows;

namespace WpfRcp.Services.Commands
{
    public class MenuTab : IMenuTab
    {
        public MenuTab(string name)
        {
            Name = name;
        }

        public string Name { get; private set; }

        public string Text { get; set; }

        public string Description { get; set; }

        public object Icon { get; set; }

        public int Position { get; set; }

        private DependencyObject m_Visual;
        public DependencyObject Visual
        {
            get { return m_Visual; }
            set
            {
                m_Visual = value;
                OnVisualCreated();
            }
        }

        public event EventHandler VisualCreated;

        public IMenuTab SetText(string text)
        {
            Text = text;
            return this;
        }

        public IMenuTab SetDescription(string description)
        {
            Description = description;
            return this;
        }

        public IMenuTab SetIcon(object icon)
        {
            Icon = icon;
            return this;
        }

        public IMenuTab SetPosition(int position)
        {
            Position = position;
            return this;
        }

        private void OnVisualCreated()
        {
            if (VisualCreated != null)
                VisualCreated(this, EventArgs.Empty);
        }
    }
}
